<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>
<link href="<?php echo CSS_PATH?>dialog.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>dialog.js"></script>
<div class="pad-10">
<div class="common-form">
<form name="myform" action="<?php echo U('add');?>" method="post" id="myform">
<fieldset>
	<legend>任务信息</legend>
	<table width="100%" class="table_form">
		<tr>
			<td width="80">任务标题</td>
			<td><input type="text" name="info[title]" class="input-text">&nbsp;任务的简短标题</td>
		</tr>
		<tr>
			<td width="80">简短描述</td> 
			<td>
				<textarea name="info[description]" id="" cols="60" rows="6"></textarea>
			</td>
		</tr>		
		<tr>
			<td>奖励U币</td> 
			<td><input type="text" name="info[do_coin]" class="input-text">&nbsp;完成后奖励的U币数量</td>
		</tr>

		<tr>
			<td>任务配置</td> 
			<td>
			<fieldset class="pad_10" id="config_box">
				<legend>详细配置</legend>
				<div>
					<div id="config_item_552" class="mb6">
						<select name="info[configs][1][task_type]">
							<option value="task">任务</option>
							<option value="cash">提现</option>
						</select>&nbsp;任务ID/提现金额：<input type="text" name="info[configs][1][task_id]" size="8" class="input-text">&nbsp;拓展参数：<input type="text" name="info[configs][1][extra]" size="6" class="input-text">&nbsp;简短描述：<input type="text" name="info[configs][1][description]" placeholder="建议简短清晰的描述" size="30" class="input-text">&nbsp;<a href="javascript:remove_div('config_item_552')">移除</a>
					</div>
				</div>
				<a href="javascript:;" onclick="_additem('answer_config');return false;">添加任务</a>
			</fieldset>
			<div class="bk10"></div>
			<div class="explain-col green">
				<strong>温馨提醒</strong>
				<ol>
					<li>1、通常情况若需调整建议「新增」而不是「修改」</li>
					<li>2、新手任务共分为「任务」与「提现」两大类</li>
					<li>3、添加「任务类」时，任务ID格式需填写「模型ID-任务ID」，「提现类」时请填写提现的U币数量即可</li>
					<li class="red">4、拓展参数主要用于试玩类，一般为试玩等级限制，非试玩类任务可留空；</li>
				</ol>
			</div>

<script type="text/javascript">
function _additem() {
	var random = parseInt(Math.random() * 10000);
	var div_num = parseInt($("#config_box > div > div.mb6").length) + 1;
	var div_id = "config_item_"+random;
	var div_html = "<div id='"+div_id+"' class='mb6'>";
	div_html += '<select name="info[configs]['+random+'][task_type]"><option value="task">任务</option><option value="cash">提现</option></select>&nbsp;';
	div_html += '任务ID/提现金额：<input type="text" name="info[configs]['+random+'][task_id]" size="8" class="input-text">&nbsp;拓展参数：<input type="text" name="info[configs]['+random+'][extra]" size="6" class="input-text">&nbsp;简短描述：<input type="text" name="info[configs][1][description]" placeholder="建议简短清晰的描述" size="30" class="input-text">&nbsp;<a href="javascript:remove_div(\''+ div_id +'\')">移除</a>';
	$("#config_box > div").append(div_html);
}
function remove_div (obj) {
	$("#"+obj).remove();
}
</script>
			</td>
		</tr>

		<tr>
			<td>当前状态</td> 
			<td>
				<label><input type="radio" name="info[status]" value="1" checked>开启</label>&nbsp;
				<label><input type="radio" name="info[status]" value="0">关闭</label>
			</td>
		</tr>		
	</table>
</fieldset>
    <div class="bk15"></div>
    <input name="dosubmit" type="submit" id="dosubmit" value="<?php echo L('submit')?>" class="button">
</form>
</div>
</div>
</body>
</html>